<%@ page import="java.util.HashMap" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="com.example.demo2.DBUtil" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Insert title here</title>
		<link rel="stylesheet" type="text/css" href="css/rest.css"/>
		<style type="text/css">
		body{width: 100%;height: 100%;}
		*{margin: 0;padding: 0;}
			.bjt{background:radial-gradient(#6f4351,#40325b);width: 100%;height: 120px;}
			.huixiang{width: 200px;height: 80px;position: absolute;left: 0px;top: 10px;}
			.ziti{font-size: 25px;font-style: italic;font-family: 宋体;color:#91b5ff ;font-weight: 600;position: absolute;left:180px;top: 44px;}
			li{float: left;font-size: 22px;padding: 10px;margin-left: 60px;color: aqua;}
			.liebiao{position: absolute;left: 300px;top: 35px;}
			.zixuankuang{font-size: 12px;color: gray;width: 210px;height:38px;position: absolute;left: 1100px;top: 38px;border-radius: 50px;}
			.sousuo{width: 40px;height: 38px;position: absolute;left: 1274px;top: 40px;border-radius: 50px;background-color: dimgray;}
			.yonghu{margin-right: 10px;border-radius: 50px;width: 50px;height: 50px;left: 1390px;top: 30px;}
			.denglu{display: flex;font-size: 20px;position: absolute;left: 1440px;top: 30px;color:#91b5ff ;}
			.lbt{width: 2000px;height: 500px;background-color: #222222;}
			.tu{width: 1300px;height: 500px;}
			li>a{color: white;}
			.denglu>a{color: white;}
			.yi{width: 850px;height: 900px;position: absolute;left:130px;top: 180px;}
			.one{font-size: 30px;width: 300px;height: 70px;}
			.quanbu{font-size: 20px;color: gray;position: absolute;left: 750px;top:18px;}
			.qtu-1{width: 160px;height: 220px;}
			a:hover .goupiao{background-color: red;color: white;}
			a:hover .yfp-8{background-color: red;color: white;}
			a:hover .ys-8{background-color: red;color: white;}
			a:hover .yfp-7{background-color: red;color: white;}
			a:hover .ys-7{background-color: red;color: white;}
			a:hover .yfp-6{background-color: red;color: white;}
			a:hover .ys-6{background-color: red;color: white;}
			a:hover .yfp-5{background-color: red;color: white;}
			a:hover .ys-5{background-color: red;color: white;}
			a:hover .yfp-4{background-color: red;color: white;}
			a:hover .ys-4{background-color: red;color: white;}
			a:hover .yfp-3{background-color: red;color: white;}
			a:hover .ys-3{background-color: red;color: white;}
			a:hover .yfp-2{background-color: red;color: white;}
			a:hover .ys-2{background-color: red;color: white;}
			a:hover .yfp-1{background-color: red;color: white;}
			a:hover .ys-1{background-color: red;color: white;}
			a:hover .yfp{background-color: red;color: white;}
			a:hover .ys{background-color: red;color: white;}
			.goupiao{width: 156px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 20px;letter-spacing: 8px;}
			/*.qtu-2{width: 160px;height: 220px;margin-left: 50px;}*/
			.jinripiaofang{width: 400px;height: 580px;position: absolute;left: 920px;top: 52px;}
			.pf{font-size: 30px;margin-left: 40px;}
			.pf-1{width: 400px;height: 50px;margin-top: 20px;    display: flex;align-items: center;}
			.shuzi-0{font-size: 35px;font-style: italic;width: 50px;color: red;margin-left: 20px;height: 60px;line-height: 60px;}
			.haidaowang{font-size: 22px;}
			.shuzi-1{font-size: 35px;font-style: italic;width: 50px;color:lightblue;margin-left: 20px;height: 60px;line-height: 60px;}
			.shuzi-2{font-size: 35px;font-style: italic;width: 50px;color:darkorange;margin-left: 20px;height: 60px;line-height: 60px;}
			.shuzi-3{font-size: 35px;font-style: italic;width: 50px;color:plum;margin-left: 20px;height: 60px;line-height: 60px;}
			.shuzi-4{font-size: 35px;font-style: italic;width: 50px;color:lawngreen;margin-left: 20px;height: 60px;line-height: 60px;}

		.haidaowang{font-size: 22px;width: 100%;margin-left: 5%;}
			.haidaowang>a:hover{
				color: red;
			}
			.waikuang{width: 400px;height: 120px;margin-top: 40px;}
			.jinridapan{writing-mode:tb;width: 50px;background-color: dimgray;height: 120px;font-size: 20px;text-align:center;letter-spacing: 8px;color: white;}
			.p{position: absolute;left: 10px;top: 435px;}
			.o-1{font-size: 36px;color: gray;font-weight: 600;font-style: italic;position: absolute;left: 80px;top: 450px;}
			.o-2{font-size: 18px;position: absolute;left: 60px;top: 510px;}
			.o-3{font-size: 22px;position: absolute;left: 280px;top: 460px;}
			
			.er{width: 850px;height: 900px;position: absolute;left:0px;top: 800px;}
			.q-1{width: 160px;height: 220px;}
			.yfp-1{width: 76px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;}
			.ys-1{width: 75px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;}
			.shangying{font-size: 16px;
				width: 160px;
				display: flex;
				justify-content: center;}
			
			.q-2{width: 160px;height: 220px;margin-left: 40px;}
			.yfp-2{width: 80px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 290px;left: 206px;}
			.ys-2{width: 75px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 290px;left: 287px;}
			.shangying-1{font-size: 16px;position: absolute;left: 230px;top: 350px;}
		
			.q-3{width: 160px;height: 220px;margin-left: 40px;}
			.yfp-3{width: 80px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 290px;left:410px;}
			.ys-3{width: 75px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 290px;left:491px;}
			.shangying-2{font-size: 16px;position: absolute;left: 440px;top: 350px;}
			
			.q-4{width: 160px;height: 220px;margin-left: 40px;}
			.yfp-4{width: 80px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 290px;left:614px;}
			.ys-4{width: 75px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 290px;left:696px;}
			.shangying-3{font-size: 16px;position: absolute;left:650px;top: 350px;}
		
			.q-5{width: 160px;height: 220px;margin-top: 100px;}
			.yfp-5{width: 80px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top:614px;}
			.ys-5{width: 75px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 614px;left:82px;}
			.shangying-4{font-size: 16px;position: absolute;left:20px;top: 680px;}
		
			.q-6{width: 160px;height: 220px;margin-top: 100px;margin-left: 40px;}
			.yfp-6{width: 80px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top:614px;left: 206px;}
			.ys-6{width: 75px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 614px;left:287px;}
			.shangying-5{font-size: 16px;position: absolute;left:230px;top: 680px;}
		
			.q-7{width: 160px;height: 220px;margin-top: 100px;margin-left: 40px;}
			.yfp-7{width: 80px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top:614px;left: 410px;}
			.ys-7{width: 75px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 614px;left:491px;}
			.shangying-6{font-size: 16px;position: absolute;left:440px;top: 680px;}
					
			.q-8{width: 160px;height: 220px;margin-top: 100px;margin-left: 40px;}
			.yfp-8{width: 80px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top:614px;left: 614px;}
			.ys-8{width: 75px;height: 40px;border:solid 2px lightgray;text-align: center;line-height: 40px;font-size: 15px;letter-spacing: 8px;font-weight: 200;position: absolute;top: 614px;left:696px;}
			.shangying-7{font-size: 16px;position: absolute;left:650px;top: 680px;}
			.quanbu-1{font-size: 20px;color: gray;position: absolute;left: 720px;top:18px;}
		
		.zuishouqidai{width: 400px;height: 580px;position: absolute;left: 920px;top: 852px;}
			.qidai{font-size: 30px;margin-left: 40px;}
			.a-1{width: 150px;height: 180px;}
			.m-1{width: 400px;height: 180px;margin-top: 40px;border: solid 1px darkgray;}
			.nnxw{font-size: 22px;font-weight: 400;position: absolute;left: 240px;top: 120px;}
			.sysj{font-size: 18px;position: absolute;left: 200px;top: 170px;}
			.gkrs{position: absolute;left: 230px;top: 210px;}
			.rebo{width: 30px;height: 30px;position: absolute;left: 0px;top: 81px;}
			.sz-1{font-size: 35px;font-style: italic;width: 50px;color:lightblue;margin-left: 0px;height: 60px;line-height: 60px;}
			.mry{font-size: 22px;width: 100%;
				display: flex;
				justify-content: space-between;}
			.sz-2{font-size: 35px;font-style: italic;width: 50px;color:darkorange;margin-left: 0px;height: 60px;line-height: 60px;margin-top: 20px;}
			.shenghai{font-size: 22px;position: absolute;left: 57px;top: 360px;}
			.sz-3{font-size: 35px;font-style: italic;width: 50px;color:plum;margin-left: 0px;height: 60px;line-height: 60px;margin-top: 20px;}
			.jianchafengyun{font-size: 22px;position: absolute;left: 47px;top: 440px;}
			.sz-4{font-size: 35px;font-style: italic;width: 50px;color:lawngreen;margin-left: 0px;height: 60px;line-height: 60px;margin-top: 20px;}
			.baonipingan{font-size: 22px;position: absolute;left: 47px;top: 520px;}
			.si{background-color: black;height: 300px;position: relative;top: 2000px;}
			.c1{font-size: 18px;font-weight: 300;color: white;position: absolute;left: 450px;top: 50px;}
			.c1-1{color: red;}
			.c2{font-size: 18px;font-weight: 300;position: absolute;left: 520px;top:80px;color: white;}
			.c3{font-size: 18px;font-weight: 300;color: white;position: absolute;left: 600px;top:120px;}
			.c4{height: 40px;width: 130px;position: absolute;left: 580px;top:180px;}
			.c5{height: 40px;width: 130px;position: absolute;left: 740px;top:180px;}
			.c6{height: 40px;width: 130px;position: absolute;left: 900px;top:180px;}
			.list{
				display: flex;
				flex-direction: column;
			}
		</style>
	</head>
	<body>
		<div class="bjt">
			<div class="si">
				<div class="c1">关于悦享汇：<span class="c1-1">关于我们	| 管理团队 | 投资者关系 |</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;友情链接：<span class="c1-1">美团网 | 美团下载 | 欢喜首映 |</span></div>
				<div class="c2">QQ邮箱：2112633811.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;客服电话：152425125</div>
				<div class="c3">悦享汇用户服务协议 |			悦享汇平台交易规则总则 | 			隐私政策 |</div>
				<img src="img/C9.png"class="c4" >
				<img src="img/C8.png"class="c5" >
				<img src="img/C7.png"class="c6" >
				
			</div>
			<img src="img/R-C.png" class="huixiang">
			<div class="ziti">悦享汇电影</div>
			<div class="liebiao">
				<ul>
				<li><a href="shouye.jsp">首页</a></li>
				<li><a href="dianying.jsp">电影</a></li>
				<li><a href="yingyuan.jsp">影院</a></li>
				<li><a href="bangdan.jsp">榜单</a></li>
				<li><a href="redian.jsp">热点</a></li>
				<li><a href="shangcheng.jsp">商城</a></li>
			</ul>
			</div>
			<%@include file="sousuo.jsp"%>
			<%@include file="dl.jsp"%>

		</div>
			<div class="yi" >

					<%
						Connection cn = null;
						PreparedStatement ps = null;

						ResultSet rs = null;
						String sql = "";
						cn = DBUtil.getConnection();
						sql = "select * from goods limit 0,8";
						ps = cn.prepareStatement(sql);

						int count = 0;
						PreparedStatement num = null;
						num = cn.prepareStatement("select count(*) as totalCount from goods where 1=1");

						rs = num.executeQuery();
						if(rs.next()) {
							count=rs.getInt("totalCount");
						}

						rs = ps.executeQuery();

					%>
					<div class="one">正在热映（<%=count%>部）</div>
					<div class="quanbu"><a href="#">全部</a>></div>
					<div style="display: grid;grid-template-columns: repeat(4, 1fr);grid-row-gap: 5%;">
						<%
							while(rs.next()){
								int id = rs.getInt("id");
								String name = rs.getString("name");
								String img = rs.getString("img");
						%>
						<div class="list">
							<img src="<%=img%>" class="qtu-1">
							<a href="goupiao.jsp?id=<%=id%>"><div class="goupiao">
								购票
							</div></a>
						</div>
						<%
							}
						%>
					</div>

				<div class="jinripiaofang">
					<div class="pf">今日票房</div>
					<%
						sql = "select * from today_list";
						ps = cn.prepareStatement(sql);
						rs = ps.executeQuery();
						int index =0;
						while(rs.next()) {
							int pm_id = rs.getInt("id");
							String name = rs.getString("name");
							double number = rs.getDouble("number");
					%>
					<div class="pf-1">
						<div class="shuzi-<%=index%>"><%=pm_id%></div>
						<div class="haidaowang">
							<div style="width: 100%;display: flex;justify-content: space-between;">
								<span><%=name%></span>
								<span><%=number%>万</span>
							</div>
						</div>
					</div>
					<%
							index++;
						}
					%>
				<div class="waikuang">
					<div class="jinridapan"><div class="p">今日大盘</div></div>
						<div class="o-1">
							17.1万
						</div>
					<div class="o-2" >

						北京时间<span id="time"></span>
						<span style="margin-left: 20px">悦享汇电影票房数据</span>
					</div>
					<div class="o-3">
						<a href="#">查看更多<</a>
					</div>
				</div>
				</div>
				<div class="er">
					<div class="one">即将上映（<%=count%>部）</div>
					<div class="quanbu-1"><a href="#">全部></a></div>
					<%
						cn = DBUtil.getConnection();
						sql = "select * from new_goods limit 0,8";
						ps = cn.prepareStatement(sql);

						num = cn.prepareStatement("select count(*) as totalCount from new_goods where 1=1");

						rs = num.executeQuery();
						if(rs.next()) {
							count=rs.getInt("totalCount");
						}

						rs = ps.executeQuery();

					%>
					<div style="display: grid;grid-template-columns: repeat(4, 1fr);grid-row-gap: 5%;">
						<%
							while(rs.next()){
								int id = rs.getInt("id");
								String name = rs.getString("name");
								String img = rs.getString("img");
								String date = rs.getString("date");
								date = date.substring(5,date.length());
						%>
						<div class="list">
							<img src="<%=img%>"class="q-1" >
							<div style="display: flex">
								<a href="#"><div class="yfp-1">预告片</div></a>
								<a href="#"><div class="ys-1">预售</div></a>
							</div>

							<div class="shangying"><%=date%>上映</div>
						</div>
						<%
							}
						%>
					</div>
				</div>
				
				
				<div class="zuishouqidai">
					<div class="qidai">最受期待</div>
					<%
						sql = "select * from very_goods limit 0,5";
						ps = cn.prepareStatement(sql);
						rs = ps.executeQuery();
						int index2 =0;
						while(rs.next()) {
							int pm_id = rs.getInt("pm_id");
							String name = rs.getString("name");
							double number = rs.getDouble("num");
							String img = rs.getString("img");
//							System.out.println("id:" + pm_id + " 姓名：" + name + " number：" + number);
							if (index2 ==0 ){
					%>
					<div class="m-1">
						<a href="#">
							<div>
								<img src="img/rebo.png" class="rebo">
								<img src="img/p8.jpg" class="a-1">
								<div class="nnxw">念念相望</div>
								<div class="sysj">上映时间2022-12-27</div>
								<div class="gkrs">1534846人想看</div>
							</div>
						</a>
					</div>
					<%
							} else {
					%>
					<a href="#" style="display: flex; align-items: center;">
						<div class="sz-<%=index2%>"><%=pm_id%></div>
						<div class="mry">
							<div style="width: 45%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;"><%=name%></div>
							<span>1158423人想看</span>
						</div>
					</a>
					<%
							}
							index2++;
						}
					%>
				</div>
				</div>
			</div>

	<script>
		let d = document.getElementById("time")
		const xx = ()=>{

			window.location.href="denglu.jsp?tc=1";
		}
		function addZero(s) {
			return s < 10 ? ('0' + s) : s;
		}
		function date() {
			let date = new Date();
			//年 getFullYear()：四位数字返回年份
			var year = date.getFullYear();  //getFullYear()代替getYear()
			//月 getMonth()：0 ~ 11
			var month = date.getMonth() + 1;
			//日 getDate()：(1 ~ 31)
			var day = date.getDate();
			//时 getHours()：(0 ~ 23)
			var hour = date.getHours();
			//分 getMinutes()： (0 ~ 59)
			var minute = date.getMinutes();
			//秒 getSeconds()：(0 ~ 59)
			var second = date.getSeconds();
			var time = addZero(hour) + ':' + addZero(minute) + ':' + addZero(second);
			return time
		}
		d.innerHTML = date();
		(function () {
			setInterval(function() {
				let time = date()
				d.innerHTML = time
			},1500);
		})()

	</script>
	</body>
</html>
